/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package recontec.Classes;

import com.mysql.jdbc.MySQLConnection;
import javax.swing.JOptionPane;
import utilities.Data;
import utilities.MysqlConnect;

/**
 *
 * @author Baltieri
 */
public class Principal extends javax.swing.JFrame {
    
    Data mostra_data;
    Login obj_usuario;
    /**
     * Creates new form Principal
     */
    public Principal() {
        initComponents();
        mostra_data = new Data();
        mostra_data.le_data();
        label_data.setText(mostra_data.dia_semana+", "+mostra_data.dia+" de "+mostra_data.mes+" de "+mostra_data.ano);
        timer1.start();
        obj_usuario = new Login();
        obj_usuario.le_usuario();
       label_usuario.setText("Administrador"+obj_usuario.user);
        
       // mostra_data.le_hora();
        //label_hora.setText(mostra_data.hora);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        timer1 = new org.netbeans.examples.lib.timerbean.Timer();
        label_data = new javax.swing.JLabel();
        label_hora = new javax.swing.JLabel();
        jButton2 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        label_usuario = new javax.swing.JLabel();
        jButton5 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jButton7 = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();

        timer1.addTimerListener(new org.netbeans.examples.lib.timerbean.TimerListener() {
            public void onTime(java.awt.event.ActionEvent evt) {
                timer1OnTime(evt);
            }
        });

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(1024, 768));
        setName("Menu"); // NOI18N
        setResizable(false);
        getContentPane().setLayout(null);

        label_data.setBackground(new java.awt.Color(255, 255, 255));
        label_data.setFont(new java.awt.Font("Lucida Grande", 2, 24)); // NOI18N
        label_data.setForeground(new java.awt.Color(255, 255, 255));
        label_data.setText("Data");
        getContentPane().add(label_data);
        label_data.setBounds(40, 660, 810, 32);

        label_hora.setBackground(new java.awt.Color(255, 255, 255));
        label_hora.setFont(new java.awt.Font("Lucida Sans", 0, 19)); // NOI18N
        label_hora.setForeground(new java.awt.Color(255, 255, 255));
        label_hora.setText("Hora");
        getContentPane().add(label_hora);
        label_hora.setBounds(840, 60, 160, 24);

        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recontec/wizard-128.png"))); // NOI18N
        jButton2.setToolTipText("Item");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton2);
        jButton2.setBounds(360, 290, 260, 260);

        jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recontec/Explorer-Windows-8-128.png"))); // NOI18N
        jButton4.setToolTipText("Doador");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton4);
        jButton4.setBounds(300, 120, 340, 170);

        jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recontec/Reciclagem.png"))); // NOI18N
        jButton3.setToolTipText("Empresa Reciclagem");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton3);
        jButton3.setBounds(640, 120, 210, 170);

        label_usuario.setBackground(new java.awt.Color(204, 204, 204));
        label_usuario.setFont(new java.awt.Font("American Typewriter", 0, 18)); // NOI18N
        label_usuario.setForeground(new java.awt.Color(255, 255, 255));
        label_usuario.setText("Usuario");
        getContentPane().add(label_usuario);
        label_usuario.setBounds(840, 20, 150, 40);

        jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recontec/User.png"))); // NOI18N
        jButton5.setToolTipText("Funcionáro");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton5);
        jButton5.setBounds(110, 120, 190, 170);

        jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recontec/Beneficiarios2.png"))); // NOI18N
        jButton6.setToolTipText("Beneficiário");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton6);
        jButton6.setBounds(620, 290, 230, 260);

        jButton7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recontec/Computer-Metro-256.png"))); // NOI18N
        jButton7.setToolTipText("Computador");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton7);
        jButton7.setBounds(110, 290, 250, 260);

        jLabel2.setFont(new java.awt.Font("Lucida Grande", 0, 36)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("RECOMTEC");
        getContentPane().add(jLabel2);
        jLabel2.setBounds(20, 20, 360, 70);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recontec/background.jpg"))); // NOI18N
        getContentPane().add(jLabel1);
        jLabel1.setBounds(0, 0, 1024, 750);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void timer1OnTime(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timer1OnTime
        // TODO add your handling code here:
         mostra_data.le_hora();
        label_hora.setText(mostra_data.hora);
       
    }//GEN-LAST:event_timer1OnTime

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here:
        
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        // TODO add your handling code here:
        new EmpresaReciclagem().setVisible(true);
        this.dispose();
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        // TODO add your handling code here:
        new Doador().setVisible(true);
        this.dispose();
    }//GEN-LAST:event_jButton4ActionPerformed

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        // TODO add your handling code here:
        new Funcionario().setVisible(true);
        this.dispose();
    }//GEN-LAST:event_jButton5ActionPerformed

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        // TODO add your handling code here:
           new Beneficiario().show();
          this.dispose();
    }//GEN-LAST:event_jButton6ActionPerformed

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton7ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Principal().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel label_data;
    private javax.swing.JLabel label_hora;
    private javax.swing.JLabel label_usuario;
    private org.netbeans.examples.lib.timerbean.Timer timer1;
    // End of variables declaration//GEN-END:variables
}
